package com.aidong.stadium.biz.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.aidong.myprofile.dao.MyAppointmentDao;
import com.aidong.stadium.biz.MstStoreBiz;
import com.aidong.stadium.dao.MstStoreDao;
import com.aidong.stadium.entity.MstStore;
import com.aidong.stadium.entity.StoreBanner;

@Service("mstStoreBiz")
public class MstStoreBizImpl implements MstStoreBiz {
	
	private MstStoreDao mstStoreDao;

	private MyAppointmentDao appointmentDao;
	
	@Autowired
	public void setAppointmentDao(MyAppointmentDao appointmentDao) {
		this.appointmentDao = appointmentDao;
	}
	
	@Autowired
	public void setMstStoreDao(MstStoreDao mstStoreDao) {
		this.mstStoreDao = mstStoreDao;
	}
	
	/**
	 * 查询所有门店
	 */
	@Override
	public List<Map<String, Object>> getMstStore(Map<String, Object> map) {
		return mstStoreDao.getMstStore(map);
	}

	/**
	 * 门店详情
	 * @param storeId
	 * @return
	 */
	@Override
	public StoreBanner getMstStoreDetail(int storeId) {
		return mstStoreDao.getMstStoreDetail(storeId);
	}

	/**
	 * 门店服务图标
	 * @param storeId
	 * @return
	 */
	@Override
	public List<Map<String, Object>> getMstStoreService() {
		return mstStoreDao.getMstStoreService();
	}

	/**
	 * 门店预约体验介绍
	 * @param storeId
	 * @return
	 */
	@Override
	public Map<String, Object> getStoreAppointDuce(int storeId) {
		return mstStoreDao.getStoreAppointDuce(storeId);
	}

	/**
	 * 场馆不可预约时间
	 * @param storeId
	 * @return
	 */
	@Override
	public  List<Map<String, Object>> getStoreUnsubscribe(int storeId) {
		return mstStoreDao.getStoreUnsubscribe(storeId);
	}

	/**
	 * 查看当天是否已经预约该场馆
	 * @param map
	 * @return
	 */
	@Override
	public Map<String, Object> getIfAppointStadium(Map<String, Object> map) {
		return mstStoreDao.getIfAppointStadium(map);
	}

	/**
	 * 添加场馆预约信息
	 * @param map
	 */
	@Override
	public void addStadiumAppoint(MstStore store) {
		mstStoreDao.addStadiumAppoint(store);
		// 预约标记位
		Map<String, Object> paraMap = new HashMap<String, Object>();
		paraMap.put("status", 0);
		paraMap.put("idongId", store.getIdongId());
		appointmentDao.eidtMemberAppointFlg(paraMap);
	}

	/**
	 * 城市列表
	 * @return
	 */
	@Override
	public List<Map<String, Object>> getMstCity(String areaId) {
		return mstStoreDao.getMstCity(areaId);
	}

	/**
	 * 区列表
	 * @return
	 */
	@Override
	public List<Map<String, Object>> getMstRegion(String parentAreaId) {
		return mstStoreDao.getMstRegion(parentAreaId);
	}

	/**
	 * 商圈列表
	 * @return
	 */
	@Override
	public List<Map<String, Object>> getMstDistrict(String parentAreaId) {
		return mstStoreDao.getMstDistrict(parentAreaId);
	}

	/**
	 * 品牌列表
	 * @return
	 */
	@Override
	public List<Map<String, Object>> getMstBrand(Map<String, Object> map) {
		return mstStoreDao.getMstBrand(map);
	}
	
	/**
	 * 热门商圈
	 * @return
	 */
	@Override
	public List<Map<String, Object>> getMstHotDistrict(String areaId) {
		return mstStoreDao.getMstHotDistrict(areaId);
	}

	/**
	 * 修改场馆预约状态
	 * @param map
	 */
	@Override
	public void editStadiumStatus(Map<String, Object> map) {
		mstStoreDao.editStadiumStatus(map);
		// 预约标记位
		Map<String, Object> paraMap = new HashMap<String, Object>();
		paraMap.put("status", 0);
		paraMap.put("idongId", map.get("idongId"));
		appointmentDao.eidtMemberAppointFlg(paraMap);
	}

	/**
	 * 场馆数量
	 * @param brandId
	 * @return
	 */
	@Override
	public int getMstStoreByIdCount(int brandId) {
		return mstStoreDao.getMstStoreByIdCount(brandId);
	}

	/**
	 * 场馆预约提醒信息
	 * @param storeId
	 * @return
	 */
	@Override
	public Map<String, Object> getStoreAppointRemind(int storeId) {
		return mstStoreDao.getStoreAppointRemind(storeId);
	}

	/**
	 * 门店特色
	 */
	@Override
	public List<Map<String, Object>> getStoreFeature() {
		return mstStoreDao.getStoreFeature();
	}
	/**
	 * 常用自提地址
	 * @return
	 */
	public List<Map<String, Object>> getMstHotLocation(Map<String, Object> map){
		return mstStoreDao.getMstHotLocation(map);
	}
}
